﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace nplJobsDAL.Insert
{
    public class InsertJobLocationOutside : DataAccessBase
    {
        public long JobId;
        public int CountryId;
        public string CityName;

        public InsertJobLocationOutside()
        {
            StoredProcedureName = StoredProcedure.Name.spInsertJobLocationOutside.ToString();
        }

        public void Insert()
        {
            InsertJobLocationOutsideParameters parameters = new InsertJobLocationOutsideParameters(this.JobId, this.CountryId, this.CityName);
            DataBaseHelper dbHelper = new DataBaseHelper(StoredProcedureName);
            dbHelper.Parameters = parameters.Parameters;
            object LastJobSeekerProfessionalInfoID = dbHelper.RunScalar();
        }
    }
    #region SQL parameters for Location info data parameters
    class InsertJobLocationOutsideParameters
    {
        private long _JobId;
        private int _CountryId;
        private string _CityName;
        private SqlParameter[] _parameters;

        public InsertJobLocationOutsideParameters(long JobId, int CountryId, string CityName)
        {
            this._JobId = JobId;
            this._CountryId = CountryId;
            this._CityName = CityName;
            Build();
        }

        private void Build()
        {
            SqlParameter[] parameters = 
                {
                    new SqlParameter("@JobID", _JobId),
                    new SqlParameter("@CountryId", _CountryId),
                    new SqlParameter("@CityName", _CityName)
                };

            Parameters = parameters;
        }

        public SqlParameter[] Parameters
        {
            get { return _parameters; }
            set { _parameters = value; }
        }
    }
    #endregion
}
